<!DOCTYPE html>
<html>
<head>
  <!-- 页面meta -->
  <meta charset="UTF-8"/>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>青芽医疗管理平台</title>
  <meta name="description" content="数据采集分析系统">
  <meta name="keywords" content="数据采集分析系统">
  <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
  <!-- 引入样式 -->
<!--  <link rel="stylesheet" href="element-ui/lib/theme-chalk/index.css">-->
</head>
<body class="hold-transition">

<div id="app">
  <el-descriptions title="用户就诊信息" direction="horizontal" :column="2" border>
    <el-descriptions-item label="姓名">{{patients.patientName}}</el-descriptions-item>
    <el-descriptions-item label="性别">{{patients.patientGender}}</el-descriptions-item>
    <el-descriptions-item label="出生日期">{{patients.formatPatientBirthday}}</el-descriptions-item>
    <el-descriptions-item label="身份证号">{{patients.patientCardId}}</el-descriptions-item>
    <el-descriptions-item label="电话号码">{{patients.patientPhone}}</el-descriptions-item>
    <el-descriptions-item label="家庭住址">{{patients.patientAddress}}</el-descriptions-item>
    <el-descriptions-item label="医保卡" :span="2">{{patients.patientHealthInsuranceCard}}</el-descriptions-item>
  </el-descriptions>
  <br>
  <br>
  <el-descriptions title="挂号信息" direction="horizontal" :column="2" border v-if="flag">
    <el-descriptions-item label="医生姓名">{{registeredOrder.name}}</el-descriptions-item>
    <el-descriptions-item label="科室名称">{{registeredOrder.departmentName}}</el-descriptions-item>
    <el-descriptions-item label="房间名称">{{registeredOrder.roomNumber}}</el-descriptions-item>
    <el-descriptions-item label="房间描述">{{registeredOrder.roomAddress}}</el-descriptions-item>
    <el-descriptions-item label="挂号费用">{{registeredOrder.registeredFree}}</el-descriptions-item>
    <el-descriptions-item label="预约问诊时间">{{registeredOrder.formatReserveInquiryTime}}</el-descriptions-item>
    <el-descriptions-item label="挂号状态">{{registeredOrder.registeredStatus}}</el-descriptions-item>
  </el-descriptions>
</div>

</body>
<!-- 引入组件库 -->
<script src="/js/vue.js"></script>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<!--<script src="element-ui/lib/index.js"></script>-->
<script type="text/javascript" src="/js/jquery-3.3.1.min.js"></script>
<script src="/js/axios-0.18.0.js"></script>
<script type="application/javascript">
  var app = new Vue({
    el: '#app',
    data: {
      patients:{},
      registeredOrder:{},
      flag:false,
    },
    mounted () {
      this.showPatient();
    },
    methods: {
      showPatient(){
        axios.post('/user/getSessionUser').then(res => {
          var user = res.data;
          axios.post('/patient/getPatientByUserId?userId='+user.userId).then(r => {
            if(r.data==""){
              this.$message.error('该用户没有就诊信息！需要添加就诊信息才能挂号！');
            }else {
              this.patients = r.data;
              axios.post('/registeredOrder/getRegisteredOrder?patientId='+this.patients.patientId).then(res => {
                if(res.data == ""){
                  this.$message.error('今天还未挂号！！！');
                  this.flag = false;
                }else {
                  this.registeredOrder = res.data;
                  this.flag = true;
                }

              });
            }
          });
        });


      },

    }
  })
</script>
</html>